import { IsString, IsNotEmpty, IsOptional, IsEmail, IsNumber, IsArray, IsMongoId } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class CreateUserDto {
  @ApiProperty({ description: '用户名', example: 'zhangsan' })
  @IsString()
  @IsNotEmpty()
  username: string;

  @ApiProperty({ description: '密码' })
  @IsString()
  @IsNotEmpty()
  password: string;

  @ApiPropertyOptional({ description: '真实姓名' })
  @IsString()
  @IsOptional()
  realName?: string;

  @ApiPropertyOptional({ description: '电子邮箱', example: 'user@example.com' })
  @IsEmail()
  @IsOptional()
  email?: string;

  @ApiPropertyOptional({ description: '手机号码' })
  @IsString()
  @IsOptional()
  phone?: string;

  @ApiPropertyOptional({ description: '用户状态：0-禁用，1-启用', default: 1 })
  @IsNumber()
  @IsOptional()
  status?: number;

  @ApiPropertyOptional({ description: '所属组织ID' })
  @IsMongoId()
  @IsOptional()
  orgId?: string;

  @ApiPropertyOptional({ description: '角色ID列表', type: [String] })
  @IsArray()
  @IsMongoId({ each: true })
  @IsOptional()
  roleIds?: string[];
} 